var bootbox_global;
var grid;
define([
    "jquery",
    "IO",
    "bootbox"
], function ($, IO, bootbox) {

    bootbox_global = bootbox;
    $(function () {

        //每列数据列性
        var columns = [

            {
                title: '编号', dataIndex: 'User_ID', dataSource: function (data, datarow, gridobj, current_column) {

                return "<span>" + parseInt((gridobj.current_page - 1) * gridobj.page_rows + parseInt(datarow) + 1) + "</span>";
            }
            },
            //{ title: '种类id', dataIndex: 'type_id',},
            {
                title: '', dataIndex: 'gender', dataSource: function (data, datarow, gridobj, current_column) {

                var obj = data[datarow];
                var level = obj.level;

                if(level == 1)
                    return "一级";

                return "";



            }
            },
            {title: '名称', dataIndex: 'name',},


        ];


        //数组初始化

        function dataInit() {
            grid = new Grid("/budget/GetMaterialTypeList", $("#table_my_toast"), $("#paging_my_toast"), 1, 10, columns, get_input_param(), 20);

            //初始化
            grid.Init();
        }

        //获取输入框内容
        function get_input_param() {

            var param = "name=" + $("#name").val();

            return param;

        }

        dataInit();
        //查询
        $("#query").bind("click", function () {
            dataInit();
        });
    });


});